package com.nyt.report.constant;

import com.nyt.report.util.StringUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * 接口名称信息
 */
public class Methods {

    private static Map<String, String> instance= null;

    /**
     * 判断传入的参数是否在接口信息中
     * @param key
     * @return
     */
    public static Boolean exist(String key) {
        if (!StringUtils.isBlank(key)){
            return instance.keySet().contains(key);
        }
        return false;
    }

    /**
     * 获取同步方法
     *
     * @return
     */
    public static Map<String, String> syncMethod() {
        Map<String, String> target = new HashMap<>();
        instance.keySet().forEach(key -> {
            if (key.startsWith("sync"))
                target.put(key, instance.get(key));
        });
        return target;
    }

    static {
        instance = new HashMap(){{
            put("data.local.enterprise.query", "本省运输企业基本档案");
            put("data.other.enterprise.query", "外省运输企业基本档案");
            put("data.local.bus.query", "本省客运班车基本档案");
            put("data.other.bus.query", "外省客运班车基本档案");
            put("data.local.station.query", "本省汽车客运站档案");
            put("data.other.station.query", "外省汽车客运站档案");
            put("data.route.query", "线路牌档案");
            put("data.local.region.query", "本省地域行政档案");
            put("data.other.region.query", "外省地域行政档案");
            put("data.employee.query", "本省从业人员基本档案");
            put("data.vehicle.safety.query", "车辆安全例检档案");
            put("data.vehicle.pos.query", "本省车辆地理信息");
            put("data.vehicle.trail.query", "本省车辆运行轨迹播放");
            put("data.passenger.query", "乘客实名制信息");

//            put("sync.safetycases", "车辆安全例检信息");
//            put("sync.leavingsattioncheck", "车辆进出站安全监管信息");
//            put("sync.electronicroadform", "电子路单信息");
//            put("sync.platservicesstatus", "票源方售票服务状态及参数");
//            put("sync.passengershift", "班次信息");
//            put("sync.departshift", "发班班次");
//            put("sync.shiftdynamic", "班次动态信息");
//            put("sync.departinfo", "发班信息");
//            put("sync.sellticket", "售票信息");
//            put("sync.ticketchanges", "改签信息");
//            put("sync.returnticket", "退票信息");
//            put("sync.invalidticket", "销票信息");
//            put("sync.getticket", "取票信息");
//            put("sync.standbyticket", "补票信息");
//            put("sync.checkticket", "检票信息");
            put("sync.stationinfo", "到达站信息");            // 新增
            put("sync.buscompanyinfo","运输单位");          //新增

            put("e-curno.apply", "电子票号申请");
            put("e-curno.grant", "电子票号下发");
            put("e-curno.remedy.apply", "电子票号补发申请");
            put("e-curno.remedy.grant", "电子票号补发下发");

            put("trade.region.query", "区域查询");
            put("trade.station.query", "站点查询");
            put("trade.bus.query", "班次查询");
            put("trade.lock", "锁票");
            put("trade.unlock", "解锁");
            put("trade.commit", "售票(提交)");
            put("trade.confirm", "确认");
            put("trade.recovery", "销票");
            put("trade.fee.query", "退票手续费查询");
            put("trade.refund", "退票");
            put("trade.order.query", "客票查询(订单查询)");
            put("trade.curno.query", "票号查询");
            put("trade.print", "出票确认");
        }};
    }
}
